<?php
include '../include/init.php';
$q = $_POST['q'];
if(isset($q) and $q=="send"){
	$sender = "Herbes de Chine <herbesde@90plan.ovh.net>";
	$to = 'contact@herbesdechine.com';
	
	$subject = "Demande d'informations ";
	$msg .= "De : ".$_POST['mail']."<br />";
	$msg .= "Nom : ".$_POST['nom']."<br /><br />";
	$msg .= nl2br($_POST['message']);
	
	$headers="From: ".$sender."\n";
	$headers.="Reply-To: ".$_POST['nom']." <".$_POST['mail'].">\n";
	$headers.= "MIME-version: 1.0\n";
	$headers.= "Content-type: text/html; charset= UTF-8\n";
	
	$res = mail($to, $subject, $msg, $headers);
}
include $_SERVER['DOCUMENT_ROOT'].'/fr/include/close_connexion.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<? include $_SERVER['DOCUMENT_ROOT'].'/fr/include/meta.php'; ?>
	<meta name="description" content="Herbes de Chine : Contactez-nous" />
	<meta name="keywords" content="Herbes de chine,contact,contacter,contactez,contactez-nous,email,coordonnées" />
	<title>Herbes de Chine : Contactez-nous</title>
	<link href="/fr/css/common.css" rel="stylesheet" type="text/css" />
	<link href="/fr/css/inside.css" rel="stylesheet" type="text/css" />
	<link href="/fr/css/info.css" rel="stylesheet" type="text/css" />
	<script>
		<!--
		function sendMsg(){
			var form = document.formContact;
			
			if(form.nom.value == ""){
				alert ('Veuillez entrer votre nom');
				form.nom.focus();
				return false;
			}
			if(form.mail.value == ""){
				alert ('Veuillez entrer une adresse valide');
				form.mail.focus();
				return false;
			}
			if(form.message.value == ""){
				alert ('Veuillez saisir un message');
				form.message.focus();
				return false;
			}
			form.submit();
		}
		-->
	</script>
</head>
<body>
	<? include '../include/header.php'; ?>
	<div id="tools">
		<table>
			<tr>
				<td id="chemin"><a href="/fr/index.php">Accueil</a> > Contact</td>
				<td id="search">
					<? include '../include/displaytoolbar.php'; ?>
				</td>
			</tr>
		</table>
	</div>
	<?
	if(isset($res)){
		if($res==1){
			$msgerror = "Votre message a été envoyé. Nous vous répondrons dès que possible.";
		} else {
			$msgerror = "Erreur de connexion, veuillez réessayer ultérieurement. ";
		}
		?>
		<table id="body" class="widescreen">
			<tr class="top"><td colspan="2"></td></tr>
		    <tr class="middle"><td class="content">
			<h1>Contactez-nous</h1>
			<table id="contact">
				<tr>
					<td colspan="2" class="bla"><? echo $msgerror ?></td>
				</tr>
				<tr>
					<td colspan="2"><a href="/fr/info/contact.php"><img src="/img/common/retour.gif" alt="Retour" /></a></textarea></td>
				</tr>
				<tr><td colspan="2">&nbsp;</td></tr>
			</table>
			</td></tr>
			<tr class="bottom"><td colspan="2"></td></tr>
		</table><br />
		<?
	} else {
	?>
	<table id="body" class="widescreen">
		<tr class="top"><td colspan="2"></td></tr>
	    <tr class="middle"><td class="content">
		<h1>Contactez-nous</h1>
		<table id="contact"><form action="/fr/info/contact.php" method="POST" name="formContact">
			<input type="hidden" name="q" value="send" />
			<tr>
				<td colspan="2" class="bla">Herbes de Chine est à votre disposition pour toute demande d’information ou de conseil.</td>
			</tr>
			<tr>
				<td>Nom<span class="asterix">*</span></td>
				<td><input class="text" name="nom" type="text" value="" /></td>
			</tr>
			<tr>
				<td>Email<span class="asterix">*</span></td>
				<td><input class="text" name="mail" type="text" value="" /></td>
			</tr>
			<tr>
				<td>Message<span class="asterix">*</span></td>
				<td><textarea name="message"></textarea></td>
			</tr>
			<tr>
				<td colspan="2" class="aright abottom"><a href="#"><img src="/img/common/btn/envoyer.gif" alt="Envoyer" onClick="sendMsg()" /></a></textarea></td>
			</tr>
			<tr><td colspan="2">&nbsp;</td></tr>
		</form></table>
		</td></tr>
		<tr class="bottom"><td colspan="2"></td></tr>
	</table><br />
	<? } ?>
	<? include '../include/footer.php'; ?>
</body>
</html>
